import java.util.List;
import java.util.ArrayList;
import java.lang.String;

public class Solution {
    public static void main(String[] args) {
	if (args.length > 0)
		System.out.println(s.simplifyPath(args[0]));
    }

    static Solution s = new Solution();

    public String simplifyPath(String path) {
        String[] dirs = path.trim().split("/+");

	List<String> l = new ArrayList<String>();
	for (String dir : dirs) {
		if (dir.length() == 0)
			continue;
		if (dir.equals("."))	//note that we cannot use = here!
			continue;
		if (dir.equals("..")) {
			if (l.size() > 0)
				l.remove(l.size() - 1);
			continue;
		}
			
		l.add(dir);
	}

	if (l.size() == 0)
		return new String("/");
	StringBuffer sb = new StringBuffer();
	for (int i = 0; i < l.size(); ++i)
		sb.append('/' + l.get(i));

	return sb.toString();
    }
}
